package com.dingdang.controller.admin.admin;

import com.dingdang.model.AdminLeftNav;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 后台页面跳转控制类
 */
@Controller
@RequestMapping("/admin")
public class AdminViewController {

    //  管理后台登录后首页
    @RequestMapping("index")
    public String index(Model model) {
        List<AdminLeftNav> allAdminLeftNav = new ArrayList<AdminLeftNav>() {{
            add(new AdminLeftNav("常用功能", "/admin/index",1));
            add(new AdminLeftNav("加油站管理", "/admin/gasstation/gasstationIndex?index=0&openPage=gasstationCenterFirst",0));
            add(new AdminLeftNav("用户列表", "/admin/user/userIndex?index=0&openPage=userCenterFirst",0));
            add(new AdminLeftNav("优惠券管理", "/admin/activity/activityIndex?index=0&openPage=activityCenterFirst",0));
        }};
        model.addAttribute("adminLeftNav", allAdminLeftNav);
        // 打开首页第一个页面
        model.addAttribute("openPage", "firstPage");
        model.addAttribute("isHeadActive", 1);
        return "admin/index";
    }

   //管理后台登录成功后打开首页第一个页面
    @RequestMapping("firstPage")
    public String firstPage(Model model) {

        model.addAttribute("ada", 1);
        model.addAttribute("ada1", "1");
        model.addAttribute("ada1", 1);

        return "admin/firstPage";
    }
}
